<template>
  <div class="company-center">
    <el-card>
      <el-avatar shape="square" size="large" src="https://cube.elemecdn.com/9/c2/f0ee8a3c7c9638a54940382568c9dpng.png" />
      <el-form ref="form" :model="companyForm" label-width="80px">
        <el-form-item label="公司名称">
          <el-input v-model="companyForm.companyName" />
        </el-form-item>
        <el-form-item label="公司类型">
          <el-select v-model="companyForm.companyType" placeholder="请选择公司类型">
            <el-option label="互联网" value="shanghai" />
            <el-option label="电子商务" value="beijing" />
            <el-option label="游戏" value="shanghai" />
            <el-option label="广告营销" value="beijing" />
            <el-option label="医疗健康" value="shanghai" />
          </el-select>
        </el-form-item>
        <el-form-item label="所在省份">
          <el-input v-model="companyForm.companyArea" />
        </el-form-item>
        <el-form-item label="所在城市">
          <el-input v-model="companyForm.companyAddress" />
        </el-form-item>
        <el-form-item label="联系方式">
          <el-input v-model="companyForm.companyPhone" />
        </el-form-item>
        <el-form-item label="最低薪资">
          <el-input v-model="companyForm.companySalaryMin" />
        </el-form-item>
        <el-form-item label="最高薪资">
          <el-input v-model="companyForm.companySalaryMax" />
        </el-form-item>
        <el-form-item label="公司官网">
          <el-input v-model="companyForm.companyWebsite" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="公司简介">
          <mavon-editor ref="md" v-model="content" @change="change" />
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="onSubmit">修改</el-button>
          <el-button>取消</el-button>
        </el-form-item>
      </el-form>
    </el-card>

  </div>
</template>

<script>
export default {
  name: 'Index',
  data() {
    return {
      content: '',
      companyForm: {
        companyId: '',
        companyName: '',
        companyType: '',
        companyPhone: '',
        companyMessage: '',
        companyLogo: '',
        companySalaryMax: '',
        companySalaryMin: '',
        companyWebsite: '',
        companyDescription: '',
        companyArea: '',
        companyAddress: '',
        resource: ''
      }
    }
  },
  created() {
    const _this = this
    this.$http.get('/company/findCompanyInfo/' + _this.$store.state.companyId).then(function(resp) {
      console.log(resp)
      _this.companyForm = resp.data.data
      _this.content = resp.data.data.companyDescription
    })
  },
  methods: {
    onSubmit() {
      this.$http.post('/company/updateCompanyInfo', this.companyForm).then(function(resp) {
        console.log(resp)
      })
    },
    change: function(value, render) {
      this.companyForm.companyDescription = render
    }
  }
}
</script>

<style scoped>

</style>
